//
//  MCAfterGroupTimeVc.swift
//  MCBodyBuildingPro
//
//  Created by Renlvshijie on 2023/5/31.
//

import UIKit
import SnapKit
import QMUIKit


typealias afterGroupTimeBlock = (_ str:Float) ->Void

class MCAfterGroupTimeVc: MCBaseVc {
    
    ///单个显示-各种数据
    lazy var lazyRulerView:DYScrollRulerView = { [unowned self] in
        let unitStr     = "秒"
        let rulerHeight = DYScrollRulerView.rulerViewHeight
        var rulerView   = DYScrollRulerView.init(frame: CGRect.init(x: 0, y: 50, width: Int(ScreenWidth)-32, height: rulerHeight()), tminValue: 10, tmaxValue: 300, tstep: 10, tunit: unitStr, tNum:10, viewcontroller:self)
        rulerView.setDefaultValueAndAnimated(defaultValue: 150, animated: true)
        rulerView.bgColor       = UIColor.cyan
        rulerView.triangleColor = UIColor.white
        rulerView.delegate      = self
        rulerView.scrollByHand  = true
       return rulerView
    }()
    
    var groupTimeBlock:afterGroupTimeBlock?
    
    var count:Float = 150.0
    
    @IBOutlet weak var timesVIew: UIView!
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.qmui_color(withHexString: "#F7F7F9")
        self.navigationItem.title = "设置组后休息时间"
        
        
        self.timesVIew.addSubview(self.lazyRulerView)
        
        self.timesVIew.layer.cornerRadius = 6
        
    }

    @IBAction func enterSender(_ sender: UIButton) {
        
        self.groupTimeBlock!(self.count)
        
        self.navigationController?.popViewController(animated: true)
    }
    
}

extension MCAfterGroupTimeVc:DYScrollRulerDelegate {
    func dyScrollRulerViewValueChange(rulerView: DYScrollRulerView, value: Float) {
        self.count = value
    }
}
